#ifndef PTHREAD_SET_H_
#define PTHREAD_SET_H_

/*头文件*/
#include <pthread.h>		//< POSIX线程编程接口头文件
#include <cstdio>
/*CPU情况枚举*/
typedef enum {
	CPU_CORE0,				//< 核0
	CPU_CORE1,				//< 核1
	CPU_CORE2,				//< 核2
	CPU_CORE3,				//< 核3
	CPU_COREANY,			//< 任意核，由系统自由分配
}CPU_Core_Num_e;


/*宏定义*/
#define THREAD_CREATE_FAILED(name)	if((name) == false)	{perror("Thread create failed\n");}


/*函数定义*/
int CPU_Core_Get(pthread_t thread_id);																//< 绑定CPU核情况获取
bool CPU_Core_Set(pthread_attr_t* thread_attr, CPU_Core_Num_e CPU_Core, const char* name);			//< 绑定指定CPU核
bool Thread_Property_Set(const char* name, size_t* attr_size, int policy, int priority, bool detach_status, pthread_attr_t* thread_attr, CPU_Core_Num_e CPU_Core);								//< 线程属性设置函数
bool Thread_Create(const char* name, pthread_t* thread_id, size_t* attr_size, int policy, int priority, bool detach_status, void *(*work_func) (void *), CPU_Core_Num_e CPU_Core, void* arg);	//< 创建新线程函数


#endif